<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>生成订单 - 当当网</title>
		<link href="../css/login.css" rel="stylesheet" type="text/css" />
		<link href="../css/page_bottom.css" rel="stylesheet" type="text/css" />
		<link type="text/css" rel="stylesheet" href="style/validator.css" />
		<script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script>
		<script src="../js/formValidatorRegex.js" type="text/javascript"></script>
		<script src="../js/formValidator_min.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function(){
				$('#address').change(function(){
					var id = $(this).val();
					window.location='address.action?addrId='+id;
					//$('#'+id).attr('selected',true).siblings().removeAttr('selected');
				});
			});
			$(document).ready(function(){
					$.formValidator.initConfig({formid:"f",onerror:function(){alert("校验没有通过，具体错误请看错误提示")}});
						$("#receiveName").formValidator({
							onShow:"请输入收件人姓名",
							onFocus:"至少2个长度",
							onCorrect:"该收件人可以注册"})
						.inputValidator({
							min:2,
							empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空符号"},
							onError:"收件人格式不正确"});
						$("#fullAddress").formValidator({
							onShow:"请输入收件详细地址",
							onFocus:"收件人详细地址不能为空",
							onCorrect:"该详细地址可以注册"})
						.inputValidator({
							min:5,
							max:100,
							empty:{leftempty:false,rightempty:false,emptyerror:"两边不能有空符号"},
							onError:"格式不正确"});
						$("#postalCode").formValidator({
							onShow:"请输入邮政编码",
							onFocus:"邮政编码不能为空",
							onCorrect:"格式正确"})
						.regexValidator({
							regexp:"zipcode",
							datatype:"enum",
							onerror:"你输入的邮政编码格式不正确"});
						$("#mobile").formValidator({
							onShow:"请输入手机号码",
							onFocus:"格式为11位手机号码",
							onCorrect:"谢谢你的合作"})
						.regexValidator({
							regexp:["mobile"],
							datatype:"enum",
							onerror:"你输入的手机格式不正确"});
						$("#phone").formValidator({
							onShow:"请输入电话号码",
							onFocus:"格式例如：0577-88888888",
							onCorrect:"谢谢你的合作"})
						.regexValidator({
							regexp:["tel"],
							datatype:"enum",
							onerror:"你输入的电话格式不正确"});
				});
		</script>
	</head>
	<body>
		<%@include file="../common/head1.jsp"%>
		<div class="login_step">
			生成订单骤: 1.确认订单 >
			<span class="red_bold"> 2.填写送货地址</span> > 3.订单成功
		</div>
		<div class="fill_message">
			<p>
				选择地址：
				<select id="address">
					<option value="0">
						填写新地址
					</option>
					<s:iterator value="addrs">
					<s:if test="id==addrId">
						<option value="${id }" id="${id }" selected="selected">${receiveName}</option>
					</s:if>
					<s:else>
					<option value="${id }" id="${id }">${receiveName}</option>
					</s:else>
					</s:iterator>
				</select>
			</p>
			<form name="ctl00" method="post" action="order.action" id="f">
				<input type="hidden" name="address.id" id="addressId" value="${address.id }"/>

				<table class="tab_login">
					<tr>
						<td valign="top" class="w1">
							收件人姓名：
						</td>
						<td>
							<input type="text" class="text_input" name="address.receiveName"
								id="receiveName" value="${address.receiveName }"/>
							<div id="receiveNameTip"></div>
							<div class="text_left" id="nameValidMsg">
								<p>
									请填写有效的收件人姓名
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							收件人详细地址：
						</td>
						<td>
							<input type="text" name="address.fullAddress" class="text_input"
								id="fullAddress" value="${address.fullAddress }"/>
								<div id="fullAddressTip"></div>
							<div class="text_left" id="addressValidMsg">
								<p>
									请填写有效的收件人的详细地址
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							邮政编码：
						</td>
						<td>
							<input type="text" class="text_input" name="address.postalCode"
								id="postalCode" value="${address.postalCode }"/>
							<div id="postalCodeTip"></div>
							<div class="text_left" id="codeValidMsg">
								<p>
									请填写有效的收件人的邮政编码
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							电话：
						</td>
						<td>
							<input type="text" class="text_input" name="address.phone"
								id="phone" value="${address.phone }"/>
								<div id="phoneTip"></div>
							<div class="text_left" id="phoneValidMsg">
								<p>
									请填写有效的收件人的电话
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							手机：
						</td>
						<td>
							<input type="text" class="text_input" name="address.mobile"
								id="mobile" value="${address.mobile }"/>
							<div id="mobileTip"></div>
							<div class="text_left" id="mobileValidMsg">
								<p>
									请填写有效的收件人的手机
								</p>
							</div>
						</td>
					</tr>
				</table>

				<div class="login_in">

					<a href="order_info.jsp"><input id="btnClientRegister" class="button_1" name="submit"
					type="button" value="取消" /></a>
			
				<input id="btnClientRegister" class="b    utton_1" name="submit"
					type="submit" value="下一步" />
				</div>
			</form>
		</div>
		<%@include file="../common/foot1.jsp"%>
	</body>
</html>

